{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nvar _excluded = [\"label\", \"children\", \"key\", \"type\"];\nimport * as React from 'react';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { Divider, MenuItem, MenuItemGroup, SubMenu } from '..';\nexport function parseChildren(children, keyPath) {\n  return toArray(children).map(function (child, index) {\n    if ( /*#__PURE__*/React.isValidElement(child)) {\n      var _eventKey, _child$props;\n      var key = child.key;\n      var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key;\n      var emptyKey = eventKey === null || eventKey === undefined;\n      if (emptyKey) {\n        eventKey = \"tmp_key-\".concat([].concat(_toConsumableArray(keyPath), [index]).join('-'));\n      }\n      var cloneProps = {\n        key: eventKey,\n        eventKey: eventKey\n      };\n      if (process.env.NODE_ENV !== 'production' && emptyKey) {\n        cloneProps.warnKey = true;\n      }\n      return /*#__PURE__*/React.cloneElement(child, cloneProps);\n    }\n    return child;\n  });\n}\nfunction convertItemsToNodes(list) {\n  return (list || []).map(function (opt, index) {\n    if (opt && _typeof(opt) === 'object') {\n      var _ref = opt,\n        label = _ref.label,\n        children = _ref.children,\n        key = _ref.key,\n        type = _ref.type,\n        restProps = _objectWithoutProperties(_ref, _excluded);\n      var mergedKey = key !== null && key !== void 0 ? key : \"tmp-\".concat(index); // MenuItemGroup & SubMenuItem\n\n      if (children || type === 'group') {\n        if (type === 'group') {\n          // Group\n          return /*#__PURE__*/React.createElement(MenuItemGroup, _extends({\n            key: mergedKey\n          }, restProps, {\n            title: label\n          }), convertItemsToNodes(children));\n        } // Sub Menu\n\n        return /*#__PURE__*/React.createElement(SubMenu, _extends({\n          key: mergedKey\n        }, restProps, {\n          title: label\n        }), convertItemsToNodes(children));\n      } // MenuItem & Divider\n\n      if (type === 'divider') {\n        return /*#__PURE__*/React.createElement(Divider, _extends({\n          key: mergedKey\n        }, restProps));\n      }\n      return /*#__PURE__*/React.createElement(MenuItem, _extends({\n        key: mergedKey\n      }, restProps), label);\n    }\n    return null;\n  }).filter(function (opt) {\n    return opt;\n  });\n}\nexport function parseItems(children, items, keyPath) {\n  var childNodes = children;\n  if (items) {\n    childNodes = convertItemsToNodes(items);\n  }\n  return parseChildren(childNodes, keyPath);\n}","map":{"version":3,"names":["_extends","_objectWithoutProperties","_typeof","_toConsumableArray","_excluded","React","toArray","Divider","MenuItem","MenuItemGroup","SubMenu","parseChildren","children","keyPath","map","child","index","isValidElement","_eventKey","_child$props","key","eventKey","props","emptyKey","undefined","concat","join","cloneProps","process","env","NODE_ENV","warnKey","cloneElement","convertItemsToNodes","list","opt","_ref","label","type","restProps","mergedKey","createElement","title","filter","parseItems","items","childNodes"],"sources":["/data/messenger.client/node_modules/rc-menu/es/utils/nodeUtil.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nvar _excluded = [\"label\", \"children\", \"key\", \"type\"];\nimport * as React from 'react';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { Divider, MenuItem, MenuItemGroup, SubMenu } from '..';\nexport function parseChildren(children, keyPath) {\n  return toArray(children).map(function (child, index) {\n    if ( /*#__PURE__*/React.isValidElement(child)) {\n      var _eventKey, _child$props;\n\n      var key = child.key;\n      var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key;\n      var emptyKey = eventKey === null || eventKey === undefined;\n\n      if (emptyKey) {\n        eventKey = \"tmp_key-\".concat([].concat(_toConsumableArray(keyPath), [index]).join('-'));\n      }\n\n      var cloneProps = {\n        key: eventKey,\n        eventKey: eventKey\n      };\n\n      if (process.env.NODE_ENV !== 'production' && emptyKey) {\n        cloneProps.warnKey = true;\n      }\n\n      return /*#__PURE__*/React.cloneElement(child, cloneProps);\n    }\n\n    return child;\n  });\n}\n\nfunction convertItemsToNodes(list) {\n  return (list || []).map(function (opt, index) {\n    if (opt && _typeof(opt) === 'object') {\n      var _ref = opt,\n          label = _ref.label,\n          children = _ref.children,\n          key = _ref.key,\n          type = _ref.type,\n          restProps = _objectWithoutProperties(_ref, _excluded);\n\n      var mergedKey = key !== null && key !== void 0 ? key : \"tmp-\".concat(index); // MenuItemGroup & SubMenuItem\n\n      if (children || type === 'group') {\n        if (type === 'group') {\n          // Group\n          return /*#__PURE__*/React.createElement(MenuItemGroup, _extends({\n            key: mergedKey\n          }, restProps, {\n            title: label\n          }), convertItemsToNodes(children));\n        } // Sub Menu\n\n\n        return /*#__PURE__*/React.createElement(SubMenu, _extends({\n          key: mergedKey\n        }, restProps, {\n          title: label\n        }), convertItemsToNodes(children));\n      } // MenuItem & Divider\n\n\n      if (type === 'divider') {\n        return /*#__PURE__*/React.createElement(Divider, _extends({\n          key: mergedKey\n        }, restProps));\n      }\n\n      return /*#__PURE__*/React.createElement(MenuItem, _extends({\n        key: mergedKey\n      }, restProps), label);\n    }\n\n    return null;\n  }).filter(function (opt) {\n    return opt;\n  });\n}\n\nexport function parseItems(children, items, keyPath) {\n  var childNodes = children;\n\n  if (items) {\n    childNodes = convertItemsToNodes(items);\n  }\n\n  return parseChildren(childNodes, keyPath);\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,OAAOC,OAAO,MAAM,mCAAmC;AACvD,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,IAAIC,SAAS,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC;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